#include <stdio.h>
int main()
{
	float a[9][9] = { 0 };
	int i=0, j=0;
	float row_sum[3] = { 0 };
	float sum[4] = { 0 };
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 4; j++)
		{
			 scanf_s("%f", &a[i][j]);
		}
	}
	
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 4; j++)
		{
			printf("%4.2f ", a[i][j]);
			row_sum[i] += a[i][j];

			a[i][4] = row_sum[i]/4;
		}
		printf("\n");
	}
	for (j = 0; j < 4; j++)
	{
		for (i = 0; i < 3; i++)
		{
			sum[j] += a[i][j];
			a[3][j] = sum[j]/3;
		}
	}
	printf("\n");
	for (i = 0; i < 4; i++)
	{
		for (j = 0; j < 5; j++)
		{
			printf("%4.2f ", a[i][j]);
		}
		printf("\n");
	}
	return 0;
}
